<template>
<div class="todoItem">
  
  <input  type="checkbox" :value="checked" :id="id" @change="() => toggle(id)">
  <label :for="id">{{title}}</label>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  props: {
    checked: Boolean,
    title: String,
    id: Number
  },
  emits: ['toggle'],
  setup(_, {emit}) {
    const toggle = (e: Number) => {
      emit('toggle', e)
    }

    return {
      toggle
    }
  },
})
</script>


<style scoped>
.todoItem {
  display: flex;

}
</style>